package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.entity.SetmealDish;
import com.itheima.mapper.SetmealDishMapper;
import com.itheima.service.SetmealDishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author suiweihua
 * @version 1.0
 * @description: TODO 购物车套餐分类展示菜品详情业务
 * @date 2022/6/8 19:40
 */
@Service
public class SetmealDishServiceImpl implements SetmealDishService {
    @Autowired
    private SetmealDishMapper setmealDishMapper;
    /**
     * 功能描述 :点击套餐回显菜品数据
     * @param id
     * @return : java.util.List<com.itheima.entity.Dish>
     */
    @Override
    public List<SetmealDish> dishList(Long id) {
        //校验参数
        if (id == null){
            return null;
        }

        LambdaQueryWrapper<SetmealDish> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SetmealDish::getSetmealId,id);
        List<SetmealDish> setmealDishes = setmealDishMapper.selectList(wrapper);

        return setmealDishes;
    }

}
